<template>
  <transition name="fade">
    <div
      :class="['bottom-drawer', { 'is-experience': isExperience }]"
      :style="!drawerHeight ? {} : { height: drawerHeight + 'px' }"
      v-show="isOpen"
    >
      <div class="bottom-drawer-header">
        <div>参考来源：</div>
        <v-icon name="v-close" label="提示" @click="closeDrawer"></v-icon>
      </div>
      <div class="bottom-drawer-content">
        <slot></slot>
      </div>
    </div>
  </transition>
</template>

<script>
import { getQueryVariable } from "@/utils";

export default {
  name: "ClientChat",
  components: {},
  props: {
    isOpen: {
      type: Boolean,
      default: false,
    },
    drawerHeight: {
      type: Number,
      default: 0,
    },
  },
  data() {
    const isExperience = getQueryVariable("experience");
    return {
      isExperience,
    };
  },
  created() {},
  mounted() {},
  methods: {
    closeDrawer() {
      this.$emit("update:isOpen", false);
    },
  },
};
</script>

<style lang="less" scoped>
::-webkit-scrollbar {
  background: transparent;
  width: 5px;
  height: 8px;
}
/* 滚动条轨道 */
::-webkit-scrollbar-track {
  background: transparent;
  width: 0px;
}

/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(17, 32, 70, 0.13);
}

/* 鼠标悬停在滚动条上时的滑块样式 */
// ::-webkit-scrollbar-thumb:hover {
//   background-color: #555;
// }

div {
  box-sizing: border-box;
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s, transform 0.5s;
}

.fade-enter,
.fade-leave-to {
  opacity: 0;
  transform: translateY(20px);
}
.bottom-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 80px);
  background-color: #f0f0f0;
  z-index: 999;
  border-radius: 10px 10px 0 0;
  &-header {
    // height: 40px;
    padding: 16px;
    // background: palevioletred;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  &-content {
    padding: 0 16px 16px 16px;
    height: calc(100% - 54px);
    overflow-x: hidden;
    overflow-y: overlay !important; /* 尝试使用 overlay */
    overflow-y: scroll !important; /* 如果 overlay 不支持，则使用 scroll */
  }

  &.is-experience {
    position: fixed;
    height: calc(100% - 56px);
    width: 400px;
    right: 0;
    left: auto;
    top: 56px;
    bottom: 0;
    background-color: var(--bg---c-color-bg-0, #fff);
    border-radius: var(--radius-0) var(--radius-super-large)
      var(--radius-super-large) var(--radius-0);
    border-left: 1px solid var(--color-divider-normal);
    background: var(--color-bg-1);

    /* shadow/--shadow-left-medium */
    box-shadow: var(--shadow-left-medium-x-1) var(--shadow-left-medium-y-1)
        var(--shadow-left-medium-blur-1) var(--shadow-left-medium-spread-1)
        var(--shadow-left-medium-color-1),
      var(--shadow-left-medium-x-2) var(--shadow-left-medium-y-2)
        var(--shadow-left-medium-blur-2) -4px var(--shadow-left-medium-color-2),
      var(--shadow-left-medium-x-3) var(--shadow-left-medium-y-3)
        var(--shadow-left-medium-blur-3) var(--shadow-left-medium-spread-2)
        var(--shadow-left-medium-color-3);
    .bottom-drawer-content {
      padding: 0;
    }
  }
}
</style>